package cn.wolfcode.wms.web.controller;

import cn.wolfcode.wms.page.PageResult;
import cn.wolfcode.wms.query.ProductStockQueryObject;
import cn.wolfcode.wms.service.IBrandService;
import cn.wolfcode.wms.service.IDepotService;
import cn.wolfcode.wms.service.IProductStockService;
import cn.wolfcode.wms.util.RequiredPermission;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Map;

@Controller
@RequestMapping("productStock")
public class ProductStockController {
    @Autowired
    private IProductStockService stockService;
    @Autowired
    private IDepotService depotService;
    @Autowired
    private IBrandService brandService;

    @RequestMapping("list")
    @RequiredPermission("库存列表")
    public String list(@ModelAttribute("qo") ProductStockQueryObject qo, Map map) {
        PageResult pageResult = stockService.query(qo);
        map.put("pageResult", pageResult);
        map.put("depots",depotService.list());
        map.put("brands",brandService.list());
        return "productStock/list";
    }
}
